package cn.ctodb.wxmp.service.mapper;

import cn.ctodb.wxmp.domain.*;
import cn.ctodb.wxmp.service.dto.TokenDTO;

import org.mapstruct.*;
import java.util.List;

/**
 * Mapper for the entity Token and its DTO TokenDTO.
 */
@Mapper(componentModel = "spring", uses = {})
public interface TokenMapper {

    @Mapping(source = "mp.id", target = "mpId")
    TokenDTO tokenToTokenDTO(Token token);

    List<TokenDTO> tokensToTokenDTOs(List<Token> tokens);

    @Mapping(source = "mpId", target = "mp")
    Token tokenDTOToToken(TokenDTO tokenDTO);

    List<Token> tokenDTOsToTokens(List<TokenDTO> tokenDTOs);

    default Mp mpFromId(Long id) {
        if (id == null) {
            return null;
        }
        Mp mp = new Mp();
        mp.setId(id);
        return mp;
    }
}
